package com.jeesite.modules.dataScreen.domain.monitoring;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
public enum MonitoringItemTyp {
    GL("公路", new String[]{"高速公路", "普通公路"}),
    TL("铁路", new String[]{"铁路"}),
    SL("水路", new String[]{"水路"}),
    MH("民航", new String[]{"民航"}),
    GJ("公交", new String[]{"公交车"}),
    CZC("出租", new String[]{"巡游出租车", "网约出租车"}),
    GD("轨道", new String[]{"轨道交通"}),
    ZF("执法", new String[]{"交通执法"}),
    GS("建设", new String[]{"交通建设"}),
    ;
    private final String code;
    private final String[] names;

    MonitoringItemTyp(String code, String[] names) {
        this.code = code;
        this.names = names;
    }

    public static String[] getNameByCode(String code) {
        for (MonitoringItemTyp value : values()) {
            if (value.code.equals(code)) {
                return value.getNames();
            }
        }
        return new String[]{};
    }

    public static String[] getAllNames() {
        String[] result = new String[]{};
        for (MonitoringItemTyp value : values()) {
            result = ArrayUtil.addAll(result, value.names);
        }
        return result;
    }
}
